import request from "@/utils/request";

//设备列表/添加设备
export function getdevice(method, data) {
  if (method == "post") {
    return request({
      url: "/device",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/device",
      method: method,
      params: data,
    });
  }
}
//设备绑定
export function devicebind(method, data) {
  if (method == "post") {
    return request({
      url: "/devicebind",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/devicebind",
      method: method,
      params: data,
    });
  }
}
//操作日志
export function deviceIotlog(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/log",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/log",
      method: method,
      params: data,
    });
  }
}
//获取设备列表
export function getdevicelist(method, data) {
  if (method == "post") {
    return request({
      url: "/device/list",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/device/list",
      method: method,
      params: data,
    });
  }
}

//温湿度状态
export function devicestatus(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/devicestatus",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/devicestatus",
      method: method,
      params: data,
    });
  }
}

//情景模式设备
export function iotdevice(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/device",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/device",
      method: method,
      params: data,
    });
  }
}

//情景模式设备
export function iotscenelist(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/scenelist",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/scenelist",
      method: method,
      params: data,
    });
  }
}

export function iotsceneedit(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/sceneedit",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/sceneedit",
      method: method,
      params: data,
    });
  }
}

//执行情景模式详情
export function iotsceneexecute(method, data) {
  if (method == "post") {
    return request({
      url: "/iot/sceneexecute",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/iot/sceneexecute",
      method: method,
      params: data,
    });
  }
}

//获取情景列表
//build_id,floor_id,room_id,bed_id,name
export function getdevscene(method, data) {
  if (method == "post") {
    return request({
      url: "/dev/scene",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/dev/scene",
      method: method,
      params: data,
    });
  }
}

//获取情景详情 id
export function getdevsceneinfo(method, data) {
  if (method == "post") {
    return request({
      url: "/dev/sceneinfo",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/dev/sceneinfo",
      method: method,
      params: data,
    });
  }
}

//执行情景 id
export function getdevscenedone(method, data) {
  if (method == "post") {
    return request({
      url: "/dev/done",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/dev/done",
      method: method,
      params: data,
    });
  }
}

//获取设备日志log
// /dev/smlog     start  end  code  build_id  floor_id room_id  bed_id
export function getsmlog(data) {
  return request({
    url: "/dev/smlog",
    method: 'GET',
    params: data,
  });
}

//获取设备睡眠质量检测log
// /dev/smtime     start  end  code  build_id  floor_id room_id  bed_id
export function getsmtime(data) {
  return request({
    url: "/dev/smtime",
    method: 'GET',
    params: data,
  });
}
